import { defineStore } from "pinia";
import { reactive } from "vue";

type MenuName = "userList" | "dictList" | "roleList";
export const useSearchStore = defineStore("searchState", () => {
  const search = reactive<Record<MenuName, object>>({
    userList: {},
    dictList: {},
    roleList: {},
  });

  const setSearch = (menuName: MenuName, formData: object) => {
    search[menuName] = formData;
  };

  const getSearch = (menuName: MenuName) => {
    return search[menuName];
  };
  return {
    search,
    setSearch,
    getSearch,
  };
});
